home *** CD-ROM | disk | FTP | other *** search
-
- ; 64Units.asm February 27, 1987
-
- ; Ephraim Vishniac
- ; P.O. Box 1357
- ; East Arlington, MA 02174
-
- ; This INIT expands the unit table to 64 entries and relocates to
- ; high memory, out of the system heap. The original unit table
- ; is released, freeing a few precious bytes of system heap space.
- ;
- ; Expanding the unit table from its original size of 32 (old ROMs)
- ; or 48 (new ROMs) means that more slots are available for drivers,
- ; including desk accessories. Installing desk accessories into
- ; these additional slots is your problem. ResEdit is one way;
- ; perhaps some non-Apple DA mover provides another.
- ;
- ; The expansion is limited to 64 slots because of the format of
- ; resource numbers for "owned" resources: there are only six bits
- ; to designate the resource's owner. Still, sixteen additional
- ; DA's should be enough for anyone.
-
- ; To use this INIT, assemble it, link it into a file of type 'INIT',
- ; and place the file in your system folder. It will be executed
- ; next time you start up your Mac.
-
- ; This program is in the public domain.
-
- Resource 'INIT' 128 '64 Units' 00
-
- ; This only uses a few definitions, so here they are.
-
- ; Trap.
- .TRAP _DisposPtr $A01F
-
- ; Low memory globals
- UtableBase equ $11C ; [long] Start of Unit Table
- UnitNtryCount equ $1D2 ; [word] Unit Table entry count
- SysZone equ $2A6 ; [long] Start of system heap
- ApplZone equ $2AA ; [long] Start of application heap
- BufPtr equ $10C ; [long] End of available memory
-
- ; Local equates
- MaxUnits equ 64 ; top size for unit table
-
- StartHere ; Start here!
- Move.W UnitNTryCount,D0 ; D0 = size of existing table
- Cmp.W #MaxUnits,D0 ; Table full-sized already?
- Bge FullTable ; Exit if so
-
- Move.L BufPtr,A1 ; A1 = end of available memory
- Move.W #MaxUnits-1,D1 ; D1 = loop counter for clearing
- @0 Clr.L -(A1) ; Clear a unit table entry
- DBra D1,@0 ; until whole table is clear
-
- Move.L A1,BufPtr ; Reserve new table space
-
- Move.L UTableBase,A0 ; A0 = start of old table
- SubQ.W #1,D0 ; D0 = loop counter for copying
- @1 Move.L (A0)+,(A1)+ ; Copy a unit table entry
- DBra D0,@1 ; until old table is copied
-
- Move.L BufPtr,A1 ; A1 = new table
- Move.L UTableBase,A0 ; A0 = old table
- Move.L A1,UTableBase ; Install new table
- Move.W #MaxUnits,UnitNtryCount ; Expand table
-
- ; Before disposing of the old table pointer, let's be
- ; sure that it's a plausible system heap pointer.
- Cmp.L SysZone,A0 ; above start of syszone?
- Blt StrangePlace ; exit if not
- Cmp.L ApplZone,A0 ; below start of applzone?
- Bge StrangePlace ; exit if not
- _DisposPtr ; else free table pointer
- FullTable
- StrangePlace
- Rts
-
- dc.b 'Ephraim Vishniac '
- dc.b 'P.O. Box 1357 '
- dc.b 'East Arlington, MA 02174 '
- .align 2
-
- END